﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Game1
{
    class Drawer
    {
        char gameNodeSymbol = 'o';

        public void DrawGameNode(GameNode gameNode)
        {
            Console.ForegroundColor = gameNode.color;
            Console.SetCursorPosition(gameNode.X, gameNode.Y);
            Console.Write(gameNodeSymbol);
            //Console.SetCursorPosition(0, 0);
            //Console.ForegroundColor = gameNode.color;
            Thread.Sleep(50);
            Console.ForegroundColor = ConsoleColor.White;
        }

        public void ClearGameNode(GameNode gameNode)
        {
            Console.SetCursorPosition(gameNode.X, gameNode.Y);
            Console.Write(' ');
            //Console.SetCursorPosition(0, 0);
            Thread.Sleep(50);
        }

        public static void DrawGameField(GameField gf, char ch)
        {
            int curX = gf.GameFieldX - 1;
            int curY = gf.GameFieldY - 1;
            for (int i = curY; i < gf.Heigth + 1 + gf.GameFieldY; i++)
            {
                for (int j = curX; j < gf.Width + 1 + gf.GameFieldX; j++)
                {
                    if (i == curY || i == (curY + gf.Heigth + 1) || j == curX || j == (curX + gf.Width + 1))
                    {
                        Console.SetCursorPosition(i, j);
                        Console.Write(ch);
                    }
                    else
                        Console.Write(" ");
                }
                Console.WriteLine();
            }

        }

    }
}
